##   namespaces.py 
##
##   Copyright (C) 2006-2007 alva bai (alvabai@gmail.com)
##
##   This program is free software; you can redistribute it and/or modify
##   it under the terms of the GNU General Public License as published by
##   the Free Software Foundation; either version 2, or (at your option)
##   any later version.
##
##   This program is distributed in the hope that it will be useful,
##   but WITHOUT ANY WARRANTY; without even the implied warranty of
##   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
##   GNU General Public License for more details.

"""
"""

#
# JANA core namespaces
#  from http://www.jabber.org/jana/namespaces.php as of 2003-01-12
#  "myname" means that namespace didnt have a name in the jabberd headers
#
NS_AGENT      = "jabber:iq:agent"
NS_AGENTS     = "jabber:iq:agents"
NS_AUTH       = "jabber:iq:auth"
NS_CLIENT     = "jabber:client"
NS_DELAY      = "jabber:x:delay"
NS_OOB        = "jabber:iq:oob"
NS_REGISTER   = "jabber:iq:register"
NS_ROSTER     = "jabber:iq:roster"
NS_XROSTER    = "jabber:x:roster" # myname
NS_SERVER     = "jabber:server"
NS_TIME       = "jabber:iq:time"
NS_VERSION    = "jabber:iq:version"

NS_COMP_ACCEPT  = "jabber:component:accept" # myname
NS_COMP_CONNECT = "jabber:component:connect" # myname


#
# JANA JEP namespaces, ordered by JEP
#  from http://www.jabber.org/jana/namespaces.php as of 2003-01-12
#  all names by jaclu
#
_NS_PROTOCOL  = "http://jabber.org/protocol" # base for other
NS_PASS       = "jabber:iq:pass" # JEP-0003
NS_XDATA      = "jabber:x:data" # JEP-0004
NS_RPC        = "jabber:iq:rpc" # JEP-0009
NS_BROWSE     = "jabber:iq:browse" # JEP-0011
NS_LAST       = "jabber:iq:last" #JEP-0012
NS_PRIVACY    = "jabber:iq:privacy" # JEP-0016
NS_XEVENT     = "jabber:x:event" # JEP-0022
NS_XEXPIRE    = "jabber:x:expire" # JEP-0023
NS_XENCRYPTED = "jabber:x:encrypted" # JEP-0027
NS_XSIGNED    = "jabber:x:signed" # JEP-0027
NS_P_MUC      = _NS_PROTOCOL + "/muc" # JEP-0045
NS_VCARD      = "vcard-temp" # JEP-0054

NS_PRIVATE      ='jabber:iq:private'
NS_SIGNED       ='jabber:x:signed'                                      # JEP-0027
NS_VERSION      ='jabber:iq:version'
NS_SEARCH       ='jabber:iq:search'
NS_DIALBACK     ='jabber:server:dialback'
NS_ENCRYPTED    ='jabber:x:encrypted'                                   # JEP-0027
NS_EVENT        ='jabber:x:event'                                       # JEP-0022
NS_LAST         ='jabber:iq:last'


#
# Non JANA aproved, ordered by JEP
#  all names by jaclu
#
_NS_P_DISCO     = _NS_PROTOCOL + "/disco" # base for other
NS_P_DISC_INFO  = _NS_P_DISCO + "#info" # JEP-0030
NS_P_DISC_ITEMS = _NS_P_DISCO + "#items" # JEP-0030
NS_P_COMMANDS   = _NS_PROTOCOL + "/commands" # JEP-0050

#NS_COMPONENT_1  ='http://jabberd.jabberstudio.org/ns/component/1.0'

NS_ACTIVITY     =_NS_PROTOCOL + '/activity'                  # JEP-0108
NS_ADDRESS      =_NS_PROTOCOL + '/address'                   # JEP-0033
NS_AMP          =_NS_PROTOCOL + '/amp'
NS_AMP_ERRORS   =NS_AMP+'#errors'
NS_BYTESTREAM   =_NS_PROTOCOL + '/bytestreams'               # JEP-0065
NS_CAPS         =_NS_PROTOCOL + '/caps'                      # JEP-0115
NS_CHATSTATES   =_NS_PROTOCOL + '/chatstates'                # JEP-0085
NS_COMMANDS     =_NS_PROTOCOL + '/commands'
NS_COMPRESS     =_NS_PROTOCOL + '/compress'                  # JEP-0138
NS_FEATURE      =_NS_PROTOCOL + '/feature-neg'  
NS_FILE         =_NS_PROTOCOL + '/si/profile/file-transfer'  # JEP-0096
NS_GEOLOC       =_NS_PROTOCOL + '/geoloc'                    # JEP-0080
NS_GROUPCHAT    ='gc-1.0'
NS_HTTP_BIND    =_NS_PROTOCOL + '/httpbind'                  # JEP-0124
NS_IBB          =_NS_PROTOCOL + '/ibb'
NS_MOOD         =_NS_PROTOCOL + '/mood'                      # JEP-0107
NS_MUC          =_NS_PROTOCOL + '/muc'
NS_MUC_USER     =NS_MUC+'#user'
NS_MUC_ADMIN    =NS_MUC+'#admin'
NS_MUC_OWNER    =NS_MUC+'#owner'
NS_PHYSLOC      =_NS_PROTOCOL + '/physloc'                   # JEP-0112
NS_PUBSUB       =_NS_PROTOCOL + '/pubsub'                    # JEP-0060
NS_ROSTERX      =_NS_PROTOCOL + '/rosterx'                   # JEP-0144
NS_SI           =_NS_PROTOCOL + '/si'                        # JEP-0096
NS_SI_PUB       =_NS_PROTOCOL + '/sipub'                     # JEP-0137
NS_WAITINGLIST  =_NS_PROTOCOL + '/waitinglist'               # JEP-0130
NS_XHTML_IM     =_NS_PROTOCOL + '/xhtml-im'                  # JEP-0071
NS_DATA_LAYOUT  =_NS_PROTOCOL + '/xdata-layout'              # JEP-0141
NS_DATA_VALIDATE=_NS_PROTOCOL + '/xdata-validate'            # JEP-0122
NS_VACATION     =_NS_PROTOCOL + '/vacation'

NS_INVISIBLE    ='presence-invisible'                                   # Jabberd2
NS_IQ           ='iq'                                                   # Jabberd2
NS_MESSAGE      ='message'                                              # Jabberd2
NS_PRESENCE     ='presence'                                             # Jabberd2
NS_SASL         ='urn:ietf:params:xml:ns:xmpp-sasl'
NS_SESSION      ='urn:ietf:params:xml:ns:xmpp-session'
NS_STANZAS      ='urn:ietf:params:xml:ns:xmpp-stanzas'
NS_STREAMS      ='http://etherx.jabber.org/streams'
NS_TLS          ='urn:ietf:params:xml:ns:xmpp-tls'
NS_VCARD        ='vcard-temp'
NS_XMPP_STREAMS ='urn:ietf:params:xml:ns:xmpp-streams'
NS_BIND         ='urn:ietf:params:xml:ns:xmpp-bind'
NS_OFFLINE      ='http://www.jabber.org/jeps/jep-0030.html'             # JEP-0013


xmpp_stream_error_conditions="""
bad-format --  --  -- The entity has sent XML that cannot be processed.
bad-namespace-prefix --  --  -- The entity has sent a namespace prefix that is unsupported, or has sent no namespace prefix on an element that requires such a prefix.
conflict --  --  -- The server is closing the active stream for this entity because a new stream has been initiated that conflicts with the existing stream.
connection-timeout --  --  -- The entity has not generated any traffic over the stream for some period of time.
host-gone --  --  -- The value of the 'to' attribute provided by the initiating entity in the stream header corresponds to a hostname that is no longer hosted by the server.
host-unknown --  --  -- The value of the 'to' attribute provided by the initiating entity in the stream header does not correspond to a hostname that is hosted by the server.
improper-addressing --  --  -- A stanza sent between two servers lacks a 'to' or 'from' attribute (or the attribute has no value).
internal-server-error --  --  -- The server has experienced a misconfiguration or an otherwise-undefined internal error that prevents it from servicing the stream.
invalid-from -- cancel --  -- The JID or hostname provided in a 'from' address does not match an authorized JID or validated domain negotiated between servers via SASL or dialback, or between a client and a server via authentication and resource authorization.
invalid-id --  --  -- The stream ID or dialback ID is invalid or does not match an ID previously provided.
invalid-namespace --  --  -- The streams namespace name is something other than "http://etherx.jabber.org/streams" or the dialback namespace name is something other than "jabber:server:dialback".
invalid-xml --  --  -- The entity has sent invalid XML over the stream to a server that performs validation.
not-authorized --  --  -- The entity has attempted to send data before the stream has been authenticated, or otherwise is not authorized to perform an action related to stream negotiation.
policy-violation --  --  -- The entity has violated some local service policy.
remote-connection-failed --  --  -- The server is unable to properly connect to a remote resource that is required for authentication or authorization.
resource-constraint --  --  -- The server lacks the system resources necessary to service the stream.
restricted-xml --  --  -- The entity has attempted to send restricted XML features such as a comment, processing instruction, DTD, entity reference, or unescaped character.
see-other-host --  --  -- The server will not provide service to the initiating entity but is redirecting traffic to another host.
system-shutdown --  --  -- The server is being shut down and all active streams are being closed.
undefined-condition --  --  -- The error condition is not one of those defined by the other conditions in this list.
unsupported-encoding --  --  -- The initiating entity has encoded the stream in an encoding that is not supported by the server.
unsupported-stanza-type --  --  -- The initiating entity has sent a first-level child of the stream that is not supported by the server.
unsupported-version --  --  -- The value of the 'version' attribute provided by the initiating entity in the stream header specifies a version of XMPP that is not supported by the server.
xml-not-well-formed --  --  -- The initiating entity has sent XML that is not well-formed."""
xmpp_stanza_error_conditions="""
bad-request -- 400 -- modify -- The sender has sent XML that is malformed or that cannot be processed.
conflict -- 409 -- cancel -- Access cannot be granted because an existing resource or session exists with the same name or address.
feature-not-implemented -- 501 -- cancel -- The feature requested is not implemented by the recipient or server and therefore cannot be processed.
forbidden -- 403 -- auth -- The requesting entity does not possess the required permissions to perform the action.
gone -- 302 -- modify -- The recipient or server can no longer be contacted at this address.
internal-server-error -- 500 -- wait -- The server could not process the stanza because of a misconfiguration or an otherwise-undefined internal server error.
item-not-found -- 404 -- cancel -- The addressed JID or item requested cannot be found.
jid-malformed -- 400 -- modify -- The value of the 'to' attribute in the sender's stanza does not adhere to the syntax defined in Addressing Scheme.
not-acceptable -- 406 -- cancel -- The recipient or server understands the request but is refusing to process it because it does not meet criteria defined by the recipient or server.
not-allowed -- 405 -- cancel -- The recipient or server does not allow any entity to perform the action.
not-authorized -- 401 -- auth -- The sender must provide proper credentials before being allowed to perform the action, or has provided improper credentials.
payment-required -- 402 -- auth -- The requesting entity is not authorized to access the requested service because payment is required.
recipient-unavailable -- 404 -- wait -- The intended recipient is temporarily unavailable.
redirect -- 302 -- modify -- The recipient or server is redirecting requests for this information to another entity.
registration-required -- 407 -- auth -- The requesting entity is not authorized to access the requested service because registration is required.
remote-server-not-found -- 404 -- cancel -- A remote server or service specified as part or all of the JID of the intended recipient does not exist.
remote-server-timeout -- 504 -- wait -- A remote server or service specified as part or all of the JID of the intended recipient could not be contacted within a reasonable amount of time.
resource-constraint -- 500 -- wait -- The server or recipient lacks the system resources necessary to service the request.
service-unavailable -- 503 -- cancel -- The server or recipient does not currently provide the requested service.
subscription-required -- 407 -- auth -- The requesting entity is not authorized to access the requested service because a subscription is required.
undefined-condition -- 500 --  -- 
unexpected-request -- 400 -- wait -- The recipient or server understood the request but was not expecting it at this time (e.g., the request was out of order)."""
sasl_error_conditions="""
aborted --  --  -- The receiving entity acknowledges an <abort/> element sent by the initiating entity; sent in reply to the <abort/> element.
incorrect-encoding --  --  -- The data provided by the initiating entity could not be processed because the [BASE64]Josefsson, S., The Base16, Base32, and Base64 Data Encodings, July 2003. encoding is incorrect (e.g., because the encoding does not adhere to the definition in Section 3 of [BASE64]Josefsson, S., The Base16, Base32, and Base64 Data Encodings, July 2003.); sent in reply to a <response/> element or an <auth/> element with initial response data.
invalid-authzid --  --  -- The authzid provided by the initiating entity is invalid, either because it is incorrectly formatted or because the initiating entity does not have permissions to authorize that ID; sent in reply to a <response/> element or an <auth/> element with initial response data.
invalid-mechanism --  --  -- The initiating entity did not provide a mechanism or requested a mechanism that is not supported by the receiving entity; sent in reply to an <auth/> element.
mechanism-too-weak --  --  -- The mechanism requested by the initiating entity is weaker than server policy permits for that initiating entity; sent in reply to a <response/> element or an <auth/> element with initial response data.
not-authorized --  --  -- The authentication failed because the initiating entity did not provide valid credentials (this includes but is not limited to the case of an unknown username); sent in reply to a <response/> element or an <auth/> element with initial response data.
temporary-auth-failure --  --  -- The authentication failed because of a temporary error condition within the receiving entity; sent in reply to an <auth/> element or <response/> element."""
